<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Quản lý</title>
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="../css/layout.css" type="text/css" media="all" />
<link rel="stylesheet" href="../css/style.css" type="text/css" media="all" />
<script type="text/javascript" src="../js/jquery-1.6.js" ></script>
<script type="text/javascript" src="../js/cufon-yui.js"></script>
<script type="text/javascript" src="../js/cufon-replace.js"></script>  
<script type="text/javascript" src="../js/Forum_400.font.js"></script>
<script type="text/javascript" src="../js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="../js/tms-0.3.js"></script>
<script type="text/javascript" src="../js/tms_presets.js"></script>
<script type="text/javascript" src="../js/script.js"></script>
<script type="text/javascript" src="../js/atooltip.jquery.js"></script> 
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body id="page1">
<center>
	<?php
		@ $con = mysql_pconnect('localhost', 'root', '');
											
		@ $nameCookie = $_COOKIE['cafe'];
							
		@ $cmnd = $_POST['cmnd'];
		@ $matkhau = $_POST['matkhau'];
		@ $matkhau = hash("sha512", $matkhau);
										
		if (!$con)
		{
			die('Could not connect: ' . mysql_error());
		}
										
		@ mysql_set_charset('utf8');
		@ mysql_select_db('cafe');
							
		$query = "SELECT * FROM `cookie` c WHERE c.cookie = '".$nameCookie."'";
		$result = mysql_query($query) or die('Error, query failed');
		$row = mysql_fetch_array($result);
		$log = stripslashes($row['log']);
							
		if( $log == 1 )
		{	
			if (isset($_COOKIE["cafe"]))
			{						
				$query = "SELECT * FROM `taikhoan` t INNER JOIN `cookie` c ON t.cmnd = c.cmnd WHERE c.cookie = '".$nameCookie."'";
				$result = mysql_query($query) or die('Error, query failed');
												
				if( mysql_num_rows($result) != 0 )
				{
					$row = mysql_fetch_array($result);
											
					$cmnd = stripslashes($row['cmnd']);
					echo "Chào ".$cmnd;
											
					if( stripslashes($row['loai']) == 1 )
					{
						$link = "../menu/chuquan.php";
					}
					else if ( stripslashes($row['loai']) == 2 )
					{
						$link = "../menu/quanly.php";
					}
					else if ( stripslashes($row['loai']) == 3 )
					{
						$link = "../menu/phucvu.php";
					}
					else if ( stripslashes($row['loai']) == 4 )
					{
						$link = "../menu/nhabep.php";
					}
					echo "&nbsp&nbsp&nbsp<a href='$link'>"."Trang tài khoản"."</a>";
					echo "&nbsp&nbsp&nbsp<a href='../login/doimatkhau.php'>"."Đổi mật khẩu"."</a>";
					echo "&nbsp&nbsp&nbsp<a href='../login/deletecookie.php'>"."Đăng xuất"."</a>";
				}
				else
				{
					echo "<a href='../login/dangnhap.php'>"."Đăng nhập"."</a>";
				}
			}
			else
			{
				echo "<a href='../login/dangnhap.php'>"."Đăng nhập"."</a>";
			}
		}
		else
		{
			echo "<a href='../login/dangnhap.php'>"."Đăng nhập"."</a>";
    	}
    ?>
    <div class="body6">
        <div class="body1">
            <div class="body5">
                <div class="main">
                    <header>
                    	<h1><a href="../home.php" id="logo">5PM Cafe</a></h1>
                    	<nav>
                    		<ul id="top_nav">
                    			<li><a href="../home.php"><img src="../images/icon_1.gif" alt=""></a></li>
                    			<li><a href="#"><img src="../images/icon_2.gif" alt=""></a></li>
                    			<li class="end"><a href="Contacts.php"><img src="../images/icon_3.gif" alt=""></a></li>
                    		</ul>
                    	</nav>
                    	<nav>
                    		<ul id="menu">
                    			<li><a href="../home.php">Nhà Hàng</a></li>
                    			<li><a href="../Cuisine.php">Am Thuc</a></li>
                    			<li><a href="../Wine.php">Ruou</a></li>
                    			<li><a href="../CookBook.php">Hoc Nau An</a></li>
                    			<li><a href="../Contacts.php">Gop Y</a></li>
                    		</ul>
                    	</nav>
                    </header><div class="ic">More Website Templates  @ TemplateMonster.com - August 1st 2011!</div>
                </div>
            </div>
        </div>
    </div>
<!-- InstanceBeginEditable name="body content" -->
<?php
	if (isset($_COOKIE["cafe"]))
   	{
		@ $con = mysql_pconnect('localhost', 'root', '');
                                    
  		@ $nameCookie = $_COOKIE['cafe'];
                                
      	if (!$con)
        {
        	die('Could not connect: ' . mysql_error());
        }
                                
        @ mysql_set_charset('utf8');
        @ mysql_select_db('cafe');
        
        $query = "SELECT * FROM `taikhoan` t INNER JOIN `cookie` c ON t.cmnd = c.cmnd  INNER JOIN `nhanvien` n ON t.cmnd = n.cmnd WHERE c.cookie = '".$nameCookie."'";
				
        $result = mysql_query($query) or die('Error, query failed');
                
        if ( mysql_num_rows($result) == 0 )
        {
         	header('location: ../login/deletecookie.php');
            exit;
        }
        else
        {
			$row = mysql_fetch_array($result);
			$loai = stripslashes($row['loai']);
			$log = stripslashes($row['log']);
					
			if( $loai == 2 && $log == 1 )
			{
				echo "<div align='center'><h1>".stripslashes($row['hoten']."</h1></div>");
			}
			else
			{
				header('location: ../login/deletecookie.php');
                exit;
			}
       	}
  	}
    else
    {
      	header('location: ../login/deletecookie.php');
        exit;
    }
?>
<br />
<fieldset>
	<legend><span style="font-size:27px;color:#230000;line-height:1.2em;padding:20px 0 9px 0;letter-spacing:-1px">QUẢN LÝ NHÂN VIÊN</span></legend>
	<a href="../execute/nhanhanvien_mod.php"><b>THÊM</b></a> tài khoản nhân viên.<br />
    <a href="../execute/xemnhanvien.php"><b>XEM</b></a> tất cả tài khoản nhân viên.<br />
</fieldset>
<br />
<fieldset>
	<legend><span style="font-size:27px;color:#230000;line-height:1.2em;padding:20px 0 9px 0;letter-spacing:-1px">THÊM MÓN ĂN</span></legend>
    <a href="../execute/themmonan.php"><b>THÊM</b></a> món ăn.<br />
    <a href="../execute/xemmonan.php"><b>XEM</b></a> tất cả món ăn.<br />
</fieldset>
<br />
<fieldset>
	<legend><span style="font-size:27px;color:#230000;line-height:1.2em;padding:20px 0 9px 0;letter-spacing:-1px">CHUYỂN ĐỔI LOẠI TÀI KHOẢN</span></legend>
    <a href="../execute/chuyendoiloaitaikhoan.php"><b>THAY ĐỔI</b></a> loại tài khoản.<br />
</fieldset>
<!-- InstanceEndEditable -->
<div class="body3">
	<div class="body4">
		<div class="main">
<!-- footer -->
			<footer>
				<div class="wrapper">
					<section class="col1 pad_left1">
						<span style="font-size:27px;color:#230000;line-height:1.2em;padding:20px 0 9px 0;letter-spacing:-1px">Liên Hệ Miễn Phí: </br>(+84) 12 0303 6166</span></br>
						<a rel="nofollow" href="../home.php" target="_blank">Bản quyền thuộc về</a> 5PM Team
					</section>
					<section class="col2 pad_left1">
						<h3>Theo Dõi 5PM Cafe </h3>
						<ul id="icons">
							<li><a href="#" class="normaltip" title="Facebook"><img src="../images/icon1.gif" alt=""></a></li>
							<li><a href="#" class="normaltip" title="Linkedin"><img src="../images/icon2.gif" alt=""></a></li>
							<li><a href="#" class="normaltip" title="Twitter"><img src="../images/icon3.gif" alt=""></a></li>
							<li><a href="#" class="normaltip" title="Delicious"><img src="../images/icon4.gif" alt=""></a></li>
							<li><a href="#" class="normaltip" title="Technorati"><img src="../images/icon5.gif" alt=""></a></li>
						</ul>
					</section>
				</div>
				<!-- {%FOOTER_LINK} -->
			</footer>
<!-- / footer -->
		</div>
	</div>
</div>
<script type="text/javascript"> Cufon.now(); </script>
</center>
</body>
<!-- InstanceEnd --></html>